﻿#region using statements

using System;

#endregion

namespace NGen.Collections
{
	/// <summary>
	/// 	A wrapper for putting objects into a priority queue and specifying an
	/// 	arbitrary priority value.
	/// </summary>
	public struct PriorityQueueNode<T> : IComparable<PriorityQueueNode<T>>
	{
		/// <summary>
		/// 	The data that is represented by this node
		/// </summary>
		public T m_nodeData;

		/// <summary>
		/// 	This is the value that will be compared for priority
		/// </summary>
		public int PriorityValue { get; set; }

		#region IComparable<PriorityQueueNode<T>> Members

		/// <summary>
		/// 	This needs to be implemented to have the comparisons
		/// </summary>
		/// <param name = "p_other"></param>
		/// <returns></returns>
		public int CompareTo(PriorityQueueNode<T> p_other) {
			if(PriorityValue > p_other.PriorityValue) {
				return 1;
			}

			return PriorityValue < p_other.PriorityValue ? -1 : 0;
		}

		#endregion
	}
}